<template>
  <el-result :title="msg" :icon="status"></el-result>
  <div style="height:300px"></div>
  <el-row justify="center">
    <el-button type="primary" @click="$emit('back')">返回</el-button>
  </el-row>
</template>

<script>
import axios from "axios";

export default {
  name: "end",
  props: ['modelValue'],
  emits:['update:modelValue'],
  data() {
    return {
      msg:'提交中!',
      status:'warning'
    }
  },
  methods:{
    submit(){
      console.log(this.form);
      this.form.classroomNeed.detailList = this.form.classroomNeed.detailList.filter((value => {
        return value !== undefined;
      }))
      console.log(this.form.classroomNeed.detailList);
      axios.post(this.$host+"/project",this.form).then(response =>{
        if(response.status === 200){
          if(response.data.code === 0){
            this.status = 'success'
            this.msg = "提交成功";
          }else{
            this.status = 'error'
            this.msg = response.data.msg;
          }
        }
      });
    }
  },
  computed:{
    form:{
      get() {
        return this.modelValue
      },
      set(value) {
        this.$emit('update:modelValue', value)
      }
    }
  },
  created() {
    this.submit();
  }
}
</script>

<style scoped>

</style>